package cn.edu.sjtu.se.dslab.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.sjtu.se.dslab.component.data.AvionicsEquipment;
import cn.edu.sjtu.se.dslab.component.data.EquipmentPropertyInstance;
import cn.edu.sjtu.se.dslab.dao.IEquipmentPropertyInstanceDao;
import cn.edu.sjtu.se.dslab.service.IEquipmentPropertyInstanceService;


@Service("equipmentPropertyInstanceService")
@Transactional
public class EquipmentPropertyInstanceServiceImpl implements
		IEquipmentPropertyInstanceService {

	@Resource(name="equipmentPropertyInstanceDao")
	private IEquipmentPropertyInstanceDao equipmentPropertyInstanceDao;
	
	@Override
	public boolean addEquipmentPropertyInstance(
			EquipmentPropertyInstance instance) {
		// TODO Auto-generated method stub
		equipmentPropertyInstanceDao.save(instance);
		return true;
	}

	@Override
	public boolean updateEquipmentPropertyInstance(
			EquipmentPropertyInstance instance) {
		// TODO Auto-generated method stub
		equipmentPropertyInstanceDao.update(instance);
		return true;
	}

	@Override
	public EquipmentPropertyInstance getEquipmentPropertyInstanceById(long id) {
		// TODO Auto-generated method stub
		return equipmentPropertyInstanceDao.queryById(id);
	}

	@Override
	public List<EquipmentPropertyInstance> getEquipmentPropertyInstanceByEquipment(
			AvionicsEquipment equipment) {
		// TODO Auto-generated method stub
		return equipmentPropertyInstanceDao.queryByEquipment(equipment);
	}

}
